import numpy
from scipy.linalg import circulant
import pyalps.hdf5 as h5
from math import pi,sqrt
from cmath import exp

D=2
V=8
t=10
skip=2

#First create hdf5 file
f=h5.oArchive('ringpyalps.h5')
istr='/input/' 
f.write(istr+"parameters/steps",t)
f.write(istr+"parameters/dimD",D)
f.write(istr+"parameters/dimV",V)
f.write(istr+"parameters/skip",skip)

#Create permutation matrices
vec=numpy.zeros(V,dtype=int)
vec[1]=1
p=circulant(vec)
istr=istr+'shift/'
f.write(istr+'1',p)
vec[1]=0
vec[V-1]=1
p=circulant(vec)
f.write(istr+'2',p)

#Create coin subgroup

c=numpy.zeros((D,D),dtype=complex)
for k in range(D):
    for l in range(D):
        c[k,l]=(1/sqrt(D))*exp(2j*pi*k*l/D)

istr='/input/coin/'
f.write(istr+'C',c)


